package action_行为型.strategy_pattern_策略模式;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: hihi
 * @Date: 2020/07/09/19:09
 * @Description:
 */
public class StrategyPatternDemo {
	public static void main(String[] args) {

		Strategy operationMultiply = new OperationMultiply();
		Strategy operationPlus = new OperationPlus();
		Strategy operationSubtract = new OperationSubtract();
		Context context = new Context(operationMultiply);
		System.err.println(context.operation(1, 2));
		System.err.println(new Context(operationPlus).operation(1, 2));
		System.err.println(new Context(operationSubtract).operation(1, 2));
	}
}
